/***********************************************************************
 * $Id : Socket.h    2011/11/13 14:34:00
 *
 *       swhors@naver.com
 * hist : 2011/11/13 14:34 first work.
***********************************************************************/  
#pragma once

class CSocket
{
public:
   CSocket();
   ~CSocket();
   int        initialize( ESOCKETTYPE aeSockType,
                          ESOCKETDIR aeConDir );
   int        initialize();
   void       finalize();
   ERETURNVAL Create();
   void       Close();
   ERETURNVAL Bind();
   ERETURNVAL Listen();
   int        getSocketFd();
   void       setListenInfo( char * aAddrStr,
                             int    aPortInt );
   void       setConnectInfo( char * aAddrStr,
                              int    aPortInt );
   int        getListenInfo( char * aAddrStr,
                             int    aBufLen,
                             int  * aPortInt );
   int        getConnectInfo( char * aAddrStr,
                              int    aBufLen,
                              int  * aPortInt );
private:
   int         mSocketfd;
   ESOCKETTYPE meSocketType;
   ESOCKETDIR  meConnectDir;
   char        mListenAddr[SOCK_ADDR_LEN];
   int         mListenPort;
   char        mConnectAddr[SOCK_ADDR_LEN];
   int         mConnectPort;
};
